package com.stm.bi.service;

import com.stm.bi.dto.cmd.ReportModelAdd;
import com.stm.bi.dto.query.ReportModelListQry;
import com.stm.bi.dto.query.ReportModelPageQry;
import com.stm.bi.dto.vo.ReportModelVO;
import com.stm.bi.executor.ReportModelQueryExe;
import com.stm.bi.executor.ReportModelSaveExe;
import com.stm.bi.model.DatatablePage;
import com.stm.framework.dto.Response;
import com.stm.framework.model.CustomizePage;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 报表模型-服务
*
* @author zhouyuanpeng
 * @date 2025-05-22
 */
@Service
public class ReportModelService {
    @Resource
    private ReportModelQueryExe reportModelQueryExe;
    @Resource
    private ReportModelSaveExe reportModelSaveExe;
    /**
    * 查询单条
    * @param id
    */
    public Response<ReportModelVO> selectById(Long id) {
        return reportModelQueryExe.selectById(id);
    }

   /**
    * 查询列表
    * @param reportModelListQry
    */
    public Response<List<ReportModelVO>> selectList(ReportModelListQry reportModelListQry) {
        return reportModelQueryExe.selectList(reportModelListQry);
    }

    /**
    * 查询页面
    * @param reportModelPageQry
    */
    public Response<CustomizePage<ReportModelVO>> selectPage(ReportModelPageQry reportModelPageQry) {
        return reportModelQueryExe.selectPage(reportModelPageQry);
    }

    /**
    * 保存
    * @param reportModelAdd
    */
    public Response<ReportModelAdd> createOrUpdate(ReportModelAdd reportModelAdd) {
        return reportModelSaveExe.createOrUpdate(reportModelAdd);
    }


    public Response<DatatablePage> reportPreview(ReportModelAdd reportModelAdd) {
        return reportModelQueryExe.reportPreview(reportModelAdd);
    }

    public Response<DatatablePage> selectRandomTable(Long modelId, Long standardId, Boolean showData) {
        return reportModelQueryExe.selectRandomTable(modelId, standardId, showData);
    }
}
